<?php /*
	*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['adminuserid']))
{
	header("location:index.php?msg=logfirst");
	die();
}

?>
<?php include("inc/header.php");?>
<body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="middlebackground">
  <tr>
    <td valign="top" align="center"><?php include(INC."top.inc.php");?></td>
  </tr> 
  <tr valign="top">
    <td align="center">
	<br /><br />
	<table width="85%" border="0" cellpadding="2" cellspacing="2" class="border">
      <tr>
        <td colspan="3" align="left">&nbsp;</td>
        <td align="left">
            <input name="Submit" type="submit" class="btn" value="Print Page" onClick="window.print();" />        </td>
      </tr>
      <tr class="bg1">
        <td colspan="4" align="left"><strong> Purchased Products...</strong></td>
        </tr>
      <tr align="center">
        <?php 
	   $rows="";
	 if(isset($_REQUEST['page']) && ($_REQUEST['page'])!="")
	 {
	 	$rows=$_REQUEST['page'];
	 
	  }	
	  ?><form name="form1" action="" method="post">
              <td colspan="4" align="left">
			  
			  Row per Page:
                <select name="page" onChange="document.form1.submit();">
                  <option value="0"<?php if($rows=='0'){echo "selected";}else{echo "";}?>>All</option>
                  <option value="5"<?php if($rows=='5'){echo "selected";}else{echo "";}?>>5 Per Page</option>
                  <option value="10"<?php if($rows=='10'){echo "selected";}else{echo "";}?>>10 Per Page</option>
                  <option value="15"<?php if($rows=='15'){echo "selected";}else{echo "";}?>>15 Per Page</option>
                </select>
				
			</td></form>
        </tr>
      <tr align="center" class="tblbg3">
	  	<td><strong>No. </strong></td>
        <td><strong>Product Title </strong></td>
        <td><strong>Product Desc </strong></td>
        <td><strong>Product Purchased</strong></td>
      </tr>

 <?php
		/**************************************
				PAGING CODE START
		**************************************/
		if(isset($_REQUEST['page']) && ($_REQUEST['page'])!=0)
			{
				$rows=$_REQUEST['page'];
				$rowperpage=$rows;
			}else{$rowperpage=$rows=10000;}

		$tablename="tblproducts";
		$per_page_keywords= "intordered >= 0";
		$per_page_sorts= "";
		$wvar = "";
		include("system/paging.inc.php");

		/**************************************
				PAGING CODE ENDING
		**************************************/

	
	$sql_select = "select * 
	from  ".$tablename."
	where ".$per_page_keywords."
	Limit ".($page_no*$row_per_page).",".$row_per_page;
	$sql = $obj_db->select($sql_select);
	if($sql)
	{
		$pgno = $page_no*$row_per_page;
		//$pgno = $pgno + 1;
	
		$i=0;
		for($j=0;$j<count($sql);$j++)
		 { 
			$screen_id=$sql[$j]['intprodid'];
			 $i=$i+1;
		 
			$sql_select1 = "select * from tblproddesc where intid=".$sql[$j]['intprodid'] ; 
			$sql1 = $obj_db->select($sql_select1);
			if($sql1)
			{
			
				for($j1=0;$j1<count($sql1);$j1++)
				{ 
		
		  ?>
	  
      <tr align="center" class="<?php echo ($i%2==0)?"Hrnormal":"Hralter"; ?>" onMouseOver="this.className='Hrhover';" onMouseOut="this.className='<?php echo ($i%2==0)?"Hrnormal":"Hralter"; ?>';">
        <td><?php echo $i+$pgno; ?>.</td>
		<td><a href="proddetails.php?prod=<?php echo stripslashes($sql[$j]['intprodid']);?>" style="cursor:hand" class="aa"><?php echo stripslashes($sql1[$j1]['varprodname']); ?></a></td>
        <td><?php 		
				  $desctxt=$sql1[$j1]['txtdesc'];

				 if(strlen($desctxt) > 15 )

				  {
				  	$desctxt=substr($desctxt,0,15);

					$desctxt=$desctxt."...";
				  }			  

				  echo stripslashes(srchwordchangestyl($desctxt));
			?>		</td>
        <td><?php echo stripslashes($sql[$j]['intprodquantity']); ?></td>
      </tr>
	 <?php } } } } ?>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
		<td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4" align="center"><?php pagindet_atbotttom_page($div_page_no,$page_no,$req_querystr,$total_db_rec,$row_per_page); ?></td>
        </tr>
	   
    </table></td>
  </tr>
  
  <tr>
    <td align="center"><?php include(INC."bottom.php");?></td>
  </tr>
</table>

</body>
</html>
